<?php
/**
 * Created by PhpStorm.
 * Script Name: MpController.php
 * Create: 2023/3/18 9:25
 * Description:
 * Author: fudaoji<fdj@kuryun.cn>
 */

namespace plugin\wechat\app;

use app\PluginController;
use plugin\wechat\app\model\Mp;
use plugin\wechat\app\model\MpFollow;

class MpController extends PluginController
{
    /**
     * 获取模板
     * @access   protected
     * @var      string
     */
    public $theme = 'default';

    /**
     * 是否需要微信网页授权，各应用可以设置此参数控制应用中的网页是否需要发起微信网页授权
     * @var bool
     */
    protected $needWxLogin = true;
    /**
     * @var MpFollow
     */
    private MpFollow $followM;
    /**
     * @var Mp
     */
    private Mp $mpM;

    public function __construct()
    {
        parent::__construct(); // TODO: Change the autogenerated stub
        $this->mpM = new Mp();
        $this->followM = new MpFollow();
    }

    public function __get($name)
    {
        $request = \request();
        switch ($name){
            case 'mpInfo':
                return $request->mpInfo;
                break;
            case 'mpApp':
                return $request->mpApp;
                break;
            case 'followInfo':
                return $request->followInfo;
                break;
            case 'tenantId':
                return $request->tenantId;
                break;
        }
        return null;
    }
}